<!DOCTYPE html>
<html lang="zh-CN" class="no-js">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="http://gmpg.org/xfn/11">
		<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>
<title>flush &#8211; 太极创客</title>
<link rel='dns-prefetch' href='//s.w.org' />
		<script>
			window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/svg\/","svgExt":".svg","source":{"concatemoji":"http:\/\/www.taichi-maker.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=5.4.4"}};
			/*! This file is auto-generated */
			!function(e,a,t){var r,n,o,i,p=a.createElement("canvas"),s=p.getContext&&p.getContext("2d");function c(e,t){var a=String.fromCharCode;s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,e),0,0);var r=p.toDataURL();return s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,t),0,0),r===p.toDataURL()}function l(e){if(!s||!s.fillText)return!1;switch(s.textBaseline="top",s.font="600 32px Arial",e){case"flag":return!c([127987,65039,8205,9895,65039],[127987,65039,8203,9895,65039])&&(!c([55356,56826,55356,56819],[55356,56826,8203,55356,56819])&&!c([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]));case"emoji":return!c([55357,56424,55356,57342,8205,55358,56605,8205,55357,56424,55356,57340],[55357,56424,55356,57342,8203,55358,56605,8203,55357,56424,55356,57340])}return!1}function d(e){var t=a.createElement("script");t.src=e,t.defer=t.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(t)}for(i=Array("flag","emoji"),t.supports={everything:!0,everythingExceptFlag:!0},o=0;o<i.length;o++)t.supports[i[o]]=l(i[o]),t.supports.everything=t.supports.everything&&t.supports[i[o]],"flag"!==i[o]&&(t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&t.supports[i[o]]);t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady=!1,t.readyCallback=function(){t.DOMReady=!0},t.supports.everything||(n=function(){t.readyCallback()},a.addEventListener?(a.addEventListener("DOMContentLoaded",n,!1),e.addEventListener("load",n,!1)):(e.attachEvent("onload",n),a.attachEvent("onreadystatechange",function(){"complete"===a.readyState&&t.readyCallback()})),(r=t.source||{}).concatemoji?d(r.concatemoji):r.wpemoji&&r.twemoji&&(d(r.twemoji),d(r.wpemoji)))}(window,document,window._wpemojiSettings);
		</script>
		<style>
img.wp-smiley,
img.emoji {
	display: inline !important;
	border: none !important;
	box-shadow: none !important;
	height: 1em !important;
	width: 1em !important;
	margin: 0 .07em !important;
	vertical-align: -0.1em !important;
	background: none !important;
	padding: 0 !important;
}
</style>
	<link rel='stylesheet' id='crayon-css'  href="../../wp-content/plugins/crayon-syntax-highlighter/css/min/crayon.min.css-ver=_2.7.2_beta.css" tppabs="http://www.taichi-maker.com/wp-content/plugins/crayon-syntax-highlighter/css/min/crayon.min.css?ver=_2.7.2_beta" media='all' />
<link rel='stylesheet' id='crayon-theme-arduino-ide-css'  href="../../wp-content/plugins/crayon-syntax-highlighter/themes/arduino-ide/arduino-ide.css-ver=_2.7.2_beta.css" tppabs="http://www.taichi-maker.com/wp-content/plugins/crayon-syntax-highlighter/themes/arduino-ide/arduino-ide.css?ver=_2.7.2_beta" media='all' />
<link rel='stylesheet' id='crayon-font-monaco-css'  href="../../wp-content/plugins/crayon-syntax-highlighter/fonts/monaco.css-ver=_2.7.2_beta.css" tppabs="http://www.taichi-maker.com/wp-content/plugins/crayon-syntax-highlighter/fonts/monaco.css?ver=_2.7.2_beta" media='all' />
<link rel='stylesheet' id='wp-block-library-css'  href="../../wp-includes/css/dist/block-library/style.min.css-ver=5.4.4.css" tppabs="http://www.taichi-maker.com/wp-includes/css/dist/block-library/style.min.css?ver=5.4.4" media='all' />
<link rel='stylesheet' id='wp-block-library-theme-css'  href="../../wp-includes/css/dist/block-library/theme.min.css-ver=5.4.4.css" tppabs="http://www.taichi-maker.com/wp-includes/css/dist/block-library/theme.min.css?ver=5.4.4" media='all' />
<link rel='stylesheet' id='genericons-css'  href="../../wp-content/themes/twentysixteen/genericons/genericons.css-ver=3.4.1.css" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/genericons/genericons.css?ver=3.4.1" media='all' />
<link rel='stylesheet' id='twentysixteen-style-css'  href="../../wp-content/themes/twentysixteen/style.css-ver=20190507.css" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/style.css?ver=20190507" media='all' />
<link rel='stylesheet' id='twentysixteen-block-style-css'  href="../../wp-content/themes/twentysixteen/css/blocks.css-ver=20190102.css" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/css/blocks.css?ver=20190102" media='all' />
<!--[if lt IE 10]>
<link rel='stylesheet' id='twentysixteen-ie-css'  href="../../wp-content/themes/twentysixteen/css/ie.css-ver=20170530.css" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/css/ie.css?ver=20170530" media='all' />
<![endif]-->
<!--[if lt IE 9]>
<link rel='stylesheet' id='twentysixteen-ie8-css'  href="../../wp-content/themes/twentysixteen/css/ie8.css-ver=20170530.css" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/css/ie8.css?ver=20170530" media='all' />
<![endif]-->
<!--[if lt IE 8]>
<link rel='stylesheet' id='twentysixteen-ie7-css'  href="../../wp-content/themes/twentysixteen/css/ie7.css-ver=20170530.css" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/css/ie7.css?ver=20170530" media='all' />
<![endif]-->
<script src="../../wp-includes/js/jquery/jquery.js-ver=1.12.4-wp" tppabs="http://www.taichi-maker.com/wp-includes/js/jquery/jquery.js?ver=1.12.4-wp"></script>
<script src="../../wp-includes/js/jquery/jquery-migrate.min.js-ver=1.4.1" tppabs="http://www.taichi-maker.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1"></script>
<script>
var CrayonSyntaxSettings = {"version":"_2.7.2_beta","is_admin":"0","ajaxurl":"http:\/\/www.taichi-maker.com\/wp-admin\/admin-ajax.php","prefix":"crayon-","setting":"crayon-setting","selected":"crayon-setting-selected","changed":"crayon-setting-changed","special":"crayon-setting-special","orig_value":"data-orig-value","debug":""};
var CrayonSyntaxStrings = {"copy":"Press %s to Copy, %s to Paste","minimize":"Click To Expand Code"};
</script>
<script src="../../wp-content/plugins/crayon-syntax-highlighter/js/min/crayon.min.js-ver=_2.7.2_beta" tppabs="http://www.taichi-maker.com/wp-content/plugins/crayon-syntax-highlighter/js/min/crayon.min.js?ver=_2.7.2_beta"></script>
<!--[if lt IE 9]>
<script src="../../wp-content/themes/twentysixteen/js/html5.js-ver=3.7.3" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/js/html5.js?ver=3.7.3"></script>
<![endif]-->
<link rel='https://api.w.org/' href='http://www.taichi-maker.com/wp-json/' />
<meta name="generator" content="WordPress 5.4.4" />
<link rel="canonical" href="http://www.taichi-maker.com/homepage/reference-index/arduino-code-reference/stream/flush/" />
<link rel='shortlink' href='http://www.taichi-maker.com/?p=7839' />
<link rel="alternate" type="application/json+oembed" href="http://www.taichi-maker.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fwww.taichi-maker.com%2Fhomepage%2Freference-index%2Farduino-code-reference%2Fstream%2Fflush%2F" />
<link rel="alternate" type="text/xml+oembed" href="http://www.taichi-maker.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fwww.taichi-maker.com%2Fhomepage%2Freference-index%2Farduino-code-reference%2Fstream%2Fflush%2F&#038;format=xml" />
<style id="custom-background-css">
body.custom-background { background-color: #45989d; }
</style>
	<link rel="icon" href="http://www.taichi-maker.com/wp-content/uploads/2016/04/cropped-taichi_logo-32x32.gif" sizes="32x32" />
<link rel="icon" href="http://www.taichi-maker.com/wp-content/uploads/2016/04/cropped-taichi_logo-192x192.gif" sizes="192x192" />
<link rel="apple-touch-icon" href="http://www.taichi-maker.com/wp-content/uploads/2016/04/cropped-taichi_logo-180x180.gif" />
<meta name="msapplication-TileImage" content="http://www.taichi-maker.com/wp-content/uploads/2016/04/cropped-taichi_logo-270x270.gif" />
</head>

<body class="page-template-default page page-id-7839 page-child parent-pageid-7771 custom-background wp-embed-responsive">
<div id="page" class="site">
	<div class="site-inner">
		<a class="skip-link screen-reader-text" href="#content">跳至内容</a>

		<header id="masthead" class="site-header" role="banner">
			<div class="site-header-main">
				<div class="site-branding">
					
											<p class="site-title"><a href="../../../../../index.htm" tppabs="http://www.taichi-maker.com/" rel="home">太极创客</a></p>
												<p class="site-description">Arduino, ESP8266物联网的应用、开发和学习资料</p>
									</div><!-- .site-branding -->

									<button id="menu-toggle" class="menu-toggle">菜单</button>

					<div id="site-header-menu" class="site-header-menu">
													<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="主菜单">
								<div class="menu-%e7%ab%99%e7%82%b9%e5%af%bc%e8%88%aa-container"><ul id="menu-%e7%ab%99%e7%82%b9%e5%af%bc%e8%88%aa" class="primary-menu"><li id="menu-item-12974" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-12974"><a href="../../../../esp8266-nodemcu-iot/iot-tuttorial/index.htm" tppabs="http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/iot-tuttorial/">物联网教程</a></li>
<li id="menu-item-9850" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-9850"><a href="../../../../iot-development/index.htm" tppabs="http://www.taichi-maker.com/homepage/iot-development/">物联网开发</a>
<ul class="sub-menu">
	<li id="menu-item-11246" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11246"><a href="../../../arduino-hardware-refrence/nodemcu/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/nodemcu/">物联网开发板</a></li>
	<li id="menu-item-11247" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11247"><a href="../../../../iot-development/iot-dev-reference/esp8266-iot-dev-ref/index.htm" tppabs="http://www.taichi-maker.com/homepage/iot-development/iot-dev-reference/esp8266-iot-dev-ref/">物联网开发资料</a></li>
	<li id="menu-item-11248" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11248"><a href="../../../../iot-development/iot-platform/index.htm" tppabs="http://www.taichi-maker.com/homepage/iot-development/iot-platform/">物联网平台</a></li>
</ul>
</li>
<li id="menu-item-2325" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-2325"><a href="../../../../arduino-tutorial-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/">Arduino 教程</a>
<ul class="sub-menu">
	<li id="menu-item-2326" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2326"><a href="../../../../arduino-basic-tutorial-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-basic-tutorial-index/">1-基础知识篇</a></li>
	<li id="menu-item-2327" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2327"><a href="../../../../arduino-tutorial-index/mearm-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/mearm-index/">2-MeArm篇</a></li>
	<li id="menu-item-2928" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2928"><a href="../../../../arduino-tutorial-index/intelligent-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/intelligent-index/">3-智能应用篇</a></li>
	<li id="menu-item-5241" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-5241"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/">4- 专项教程篇</a>
	<ul class="sub-menu">
		<li id="menu-item-7145" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-7145"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm#motor" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/#motor">4-1 电机专项</a></li>
		<li id="menu-item-7144" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-7144"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm#oop" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/#oop">4-2 面向对象基础</a></li>
		<li id="menu-item-7141" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-7141"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm#taile1" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/#taile1">4-3 太乐一号</a></li>
	</ul>
</li>
</ul>
</li>
<li id="menu-item-180" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-180"><a href="../../../arduino-hardware-refrence/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/">Arduino开发</a>
<ul class="sub-menu">
	<li id="menu-item-9847" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-9847"><a href="../../../arduino-hardware-refrence/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/">Arduino开发板</a>
	<ul class="sub-menu">
		<li id="menu-item-3632" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3632"><a href="../../../arduino-hardware-refrence/arduino-purchase-advice/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-purchase-advice/">Arduino 选购建议</a></li>
		<li id="menu-item-3634" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3634"><a href="../../../arduino-hardware-refrence/arduino-uno/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-uno/">Arduino Uno 开发板</a></li>
		<li id="menu-item-3635" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3635"><a href="../../../arduino-hardware-refrence/arduino-nano/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-nano/">Arduino Nano 开发板</a></li>
		<li id="menu-item-3636" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3636"><a href="../../../arduino-hardware-refrence/arduino-mega/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-mega/">Arduino MEGA 开发板</a></li>
	</ul>
</li>
	<li id="menu-item-11244" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11244"><a href="../../../../arduino-coding-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-coding-index/">Arduino编程</a></li>
	<li id="menu-item-179" class="menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor menu-item-has-children menu-item-179"><a href="../../../index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/">Arduino参考资料</a>
	<ul class="sub-menu">
		<li id="menu-item-3967" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-3967"><a href="../../../../arduino-coding-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-coding-index/">Arduino编程参考</a>
		<ul class="sub-menu">
			<li id="menu-item-3969" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3969"><a href="../../index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-code-reference/">Arduino 语句</a></li>
			<li id="menu-item-11487" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11487"><a href="../../../arduino-library-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-library-index/">Arduino库</a></li>
		</ul>
</li>
		<li id="menu-item-3009" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3009"><a href="../../../communication-reference-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/communication-reference-index/">Arduino通讯</a></li>
		<li id="menu-item-1853" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1853"><a href="../../../circuit-reference-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/circuit-reference-index/">电路电机参考</a></li>
		<li id="menu-item-181" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-181"><a href="../../../arduino-sensor-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-sensor-index/">传感器应用</a></li>
	</ul>
</li>
</ul>
</li>
<li id="menu-item-11817" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11817"><a href="../../../../arduino-tutorial-structure/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-structure/">教程说明</a></li>
<li id="menu-item-4792" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-4792"><a href="../../../../download/index.htm" tppabs="http://www.taichi-maker.com/homepage/download/">下载</a></li>
<li id="menu-item-12002" class="menu-item menu-item-type-post_type menu-item-object-post menu-item-12002"><a href="../../../../../faq/index.htm" tppabs="http://www.taichi-maker.com/faq/">常见问题</a></li>
<li id="menu-item-1383" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1383"><a href="../../../../../contact-us/index.htm" tppabs="http://www.taichi-maker.com/contact-us/">关于我们</a></li>
</ul></div>							</nav><!-- .main-navigation -->
						
											</div><!-- .site-header-menu -->
							</div><!-- .site-header-main -->

					</header><!-- .site-header -->

		<div id="content" class="site-content">

<div id="primary" class="content-area">
	<main id="main" class="site-main" role="main">
		
<article id="post-7839" class="post-7839 page type-page status-publish hentry">
	<header class="entry-header">
		<h1 class="entry-title">flush</h1>	</header><!-- .entry-header -->

	
	<div class="entry-content">
		<h3>说明</h3>
<p>flush函数可让开发板在所有待发数据发送完毕前，保持等待状态。</p>
<p><span style="color: #d3552d;">请注意：很多人误认为flush函数具有<a href="../clear-incoming-buffer/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-code-reference/stream/clear-incoming-buffer/" target="_blank" rel="noopener noreferrer">清除开发板接收缓存区</a>的功能。事实上此函数是没有此功能的。如需了解如何清除开发板接收缓存区内信息的方法，请点击这里进入相应说明页面。</span></p>
<p>本函数属于Stream类。该函数可被Stream类的子类所使用，如（Serial, WiFiClient, File 等）。</p>
<p>为了更好的理解flush函数的作用，我们在这里用Serial.flush()作为示例讲解。</p>
<p>当我们通过Serial.print或Serial.println来发送数据时，被发送的字符数据将会存储于开发板的“发送缓存”中。这么做的原因是开发板串行通讯速率不是很高，如果发送数据较多，发送时间会比较长。</p>
<p>在没有使用flush函数的情况下，开发板不会等待所有“发送缓存”中数据都发送完毕再执行后续的程序内容。也就是说，开发板是在后台发送缓存中的数据。程序运行不受影响。</p>
<p>相反的，在使用了flush函数的情况下，开发板是会等待所有“发送缓存”中数据都发送完毕以后，再执行后续的程序内容。</p>
<h3>语法</h3>
<p><pre>stream.flush()</pre><br />
注：此处stream为概念对象名称。在实际使用过程中，需要根据实际使用的stream子类对象名称进行替换。如：<br />
<pre>Serial.flush()
wifiClient.flush()</pre> </p>
<h3>参数</h3>
<p>无</p>
<h3>返回值</h3>
<p>无</p>
<h3>示例程序</h3>
<p>为了演示flush函数工作效果，一共为您准备了两个示例程序。这两个程序一个使用了flush函数另外一个没有使用flush函数。</p>
<p>通过这两个示例程序的运行结果比较，您可以看到flush函数的工作效果。</p>
<p>示例1：没有使用flush函数的情况下，通过串口监视器显示开发板输出一大串字符的运行效果。</p>
<p></p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id="crayon-6074ecae9f0ea883121919" class="crayon-syntax crayon-theme-arduino-ide crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 16px !important;">
		
			<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
			<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">Arduino</span></div></div>
			<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
			<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:6; -o-tab-size:6; -webkit-tab-size:6; tab-size:6; font-size: 12px !important; line-height: 16px !important;">
/**********************************************************************
项目名称/Project          : 零基础入门学用物联网
程序名称/Program name     : stream_With_flush
团队/Team                : 太极创客团队 / Taichi-Maker (www.taichi-maker.com)
作者/Author              : CYNO朔
日期/Date（YYYYMMDD）     : 20200318
程序目的/Purpose          : 
此程序使用Serial来演示Stream类中的flush函数。
flush函数可让开发板在所有发送数据全部发送完毕之前，保持等待状态。

为了演示flush函数工作效果，一共为您准备了两个示例程序。这两个程序一个使用了flush函数
另外一个没有使用flush函数。

通过这两个示例程序的运行结果比较，您可以看到flush函数的工作效果。

此程序为没有使用flush函数的情况下，通过串口监视器显示开发板在输出一大串字符的运行效果。
-----------------------------------------------------------------------
本示例程序为太极创客团队制作的《零基础入门学用物联网》中示例程序。
该教程为对物联网开发感兴趣的朋友所设计和制作。如需了解更多该教程的信息，请参考以下网页：
http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/
***********************************************************************/

void setup() {
  Serial.begin(9600);
 
  // 记录输出串口信息前的millis时间
  unsigned long millisNoFlushStart = millis();
  
  // 通过串口输出信息
  Serial.println(F("abcdefghijklmnopqrstuvwxyz"));
  
  // 记录输出串口信息后的millis时间
  unsigned long millisNoFlushStop = millis();

  // 通过串口监视器输出没有使用flush函数情况下，输出信息前后的时间差。
  Serial.print(F("NO flush: "));
  Serial.print( millisNoFlushStop - millisNoFlushStart);
  Serial.println(F(" milliseconds."));
}
void loop() {}

/*
Stream类用于处理字符数据流或二进制数据流。Stream类是不能被直接调用的。
然而当我们使用基于Stream类的库时，都会调用Stream中的内容。

以下Arduino库及相应库中的类都是基于Stream类所实现的。
 库          类
Core        Serial
Wifi        WiFiClient
Ehternet    EthernetClient
ESP8266FS   File
SD          File
Wire        Wire
GSM         GSMClient
SoftwareSerial  SoftwareSerial
-----------------------------------------------------------------------
*/</textarea></div>
			<div class="crayon-main" style="">
				<table class="crayon-table">
					<tr class="crayon-row">
				<td class="crayon-nums " data-settings="show">
					<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 16px !important;"><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-1">1</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-2">2</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-3">3</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-4">4</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-5">5</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-6">6</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-7">7</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-8">8</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-9">9</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-10">10</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-11">11</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-12">12</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-13">13</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-14">14</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-15">15</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-16">16</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-17">17</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-18">18</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-19">19</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-20">20</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-21">21</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-22">22</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-23">23</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-24">24</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-25">25</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-26">26</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-27">27</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-28">28</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-29">29</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-30">30</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-31">31</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-32">32</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-33">33</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-34">34</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-35">35</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-36">36</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-37">37</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-38">38</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-39">39</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-40">40</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-41">41</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-42">42</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-43">43</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-44">44</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-45">45</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-46">46</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-47">47</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-48">48</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-49">49</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-50">50</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-51">51</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-52">52</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-53">53</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-54">54</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-55">55</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0ea883121919-56">56</div><div class="crayon-num" data-line="crayon-6074ecae9f0ea883121919-57">57</div></div>
				</td>
						<td class="crayon-code"><div class="crayon-pre" style="font-size: 12px !important; line-height: 16px !important; -moz-tab-size:6; -o-tab-size:6; -webkit-tab-size:6; tab-size:6;"><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-1"><span class="crayon-c">/**********************************************************************</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-2"><span class="crayon-c">项目名称/Project&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 零基础入门学用物联网</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-3"><span class="crayon-c">程序名称/Program name&nbsp;&nbsp;&nbsp;&nbsp; : stream_With_flush</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-4"><span class="crayon-c">团队/Team&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 太极创客团队 / Taichi-Maker (www.taichi-maker.com)</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-5"><span class="crayon-c">作者/Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: CYNO朔</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-6"><span class="crayon-c">日期/Date（YYYYMMDD）&nbsp;&nbsp;&nbsp;&nbsp; : 20200318</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-7"><span class="crayon-c">程序目的/Purpose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-8"><span class="crayon-c">此程序使用Serial来演示Stream类中的flush函数。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-9"><span class="crayon-c">flush函数可让开发板在所有发送数据全部发送完毕之前，保持等待状态。</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-10">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-11"><span class="crayon-c">为了演示flush函数工作效果，一共为您准备了两个示例程序。这两个程序一个使用了flush函数</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-12"><span class="crayon-c">另外一个没有使用flush函数。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-13">&nbsp;</div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-14"><span class="crayon-c">通过这两个示例程序的运行结果比较，您可以看到flush函数的工作效果。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-15">&nbsp;</div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-16"><span class="crayon-c">此程序为没有使用flush函数的情况下，通过串口监视器显示开发板在输出一大串字符的运行效果。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-17"><span class="crayon-c">-----------------------------------------------------------------------</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-18"><span class="crayon-c">本示例程序为太极创客团队制作的《零基础入门学用物联网》中示例程序。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-19"><span class="crayon-c">该教程为对物联网开发感兴趣的朋友所设计和制作。如需了解更多该教程的信息，请参考以下网页：</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-20"><span class="crayon-c">http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-21"><span class="crayon-c">***********************************************************************/</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-22">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-23"><span class="crayon-t">void</span><span class="crayon-h"> </span><span class="crayon-st">setup</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-24"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-v">begin</span><span class="crayon-sy">(</span><span class="crayon-cn">9600</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-25"><span class="crayon-h"> </span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-26"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 记录输出串口信息前的millis时间</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-27"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-t">unsigned</span><span class="crayon-h"> </span><span class="crayon-r">long</span><span class="crayon-h"> </span><span class="crayon-v">millisNoFlushStart</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-st">millis</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-28"><span class="crayon-h">&nbsp;&nbsp;</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-29"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 通过串口输出信息</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-30"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">println</span><span class="crayon-sy">(</span><span class="crayon-v">F</span><span class="crayon-sy">(</span><span class="crayon-s">"abcdefghijklmnopqrstuvwxyz"</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-31"><span class="crayon-h">&nbsp;&nbsp;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-32"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 记录输出串口信息后的millis时间</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-33"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-t">unsigned</span><span class="crayon-h"> </span><span class="crayon-r">long</span><span class="crayon-h"> </span><span class="crayon-v">millisNoFlushStop</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-st">millis</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-34">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-35"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 通过串口监视器输出没有使用flush函数情况下，输出信息前后的时间差。</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-36"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">print</span><span class="crayon-sy">(</span><span class="crayon-v">F</span><span class="crayon-sy">(</span><span class="crayon-s">"NO flush: "</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-37"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">print</span><span class="crayon-sy">(</span><span class="crayon-h"> </span><span class="crayon-v">millisNoFlushStop</span><span class="crayon-h"> </span><span class="crayon-o">-</span><span class="crayon-h"> </span><span class="crayon-v">millisNoFlushStart</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-38"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">println</span><span class="crayon-sy">(</span><span class="crayon-v">F</span><span class="crayon-sy">(</span><span class="crayon-s">" milliseconds."</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-39"><span class="crayon-sy">}</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-40"><span class="crayon-t">void</span><span class="crayon-h"> </span><span class="crayon-st">loop</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span><span class="crayon-sy">}</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-41">&nbsp;</div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-42"><span class="crayon-c">/*</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-43"><span class="crayon-c">Stream类用于处理字符数据流或二进制数据流。Stream类是不能被直接调用的。</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-44"><span class="crayon-c">然而当我们使用基于Stream类的库时，都会调用Stream中的内容。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-45">&nbsp;</div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-46"><span class="crayon-c">以下Arduino库及相应库中的类都是基于Stream类所实现的。</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-47"><span class="crayon-c"> 库&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-48"><span class="crayon-c">Core&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Serial</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-49"><span class="crayon-c">Wifi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WiFiClient</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-50"><span class="crayon-c">Ehternet&nbsp;&nbsp;&nbsp;&nbsp;EthernetClient</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-51"><span class="crayon-c">ESP8266FS&nbsp;&nbsp; File</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-52"><span class="crayon-c">SD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-53"><span class="crayon-c">Wire&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wire</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-54"><span class="crayon-c">GSM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GSMClient</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-55"><span class="crayon-c">SoftwareSerial&nbsp;&nbsp;SoftwareSerial</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0ea883121919-56"><span class="crayon-c">-----------------------------------------------------------------------</span></div><div class="crayon-line" id="crayon-6074ecae9f0ea883121919-57"><span class="crayon-c">*/</span></div></div></td>
					</tr>
				</table>
			</div>
		</div>
<!-- [Format Time: 0.0013 seconds] -->
<p> </p>
<p>示例2：使用flush函数的情况下，通过串口监视器显示开发板输出一大串字符的运行效果。</p>
<p></p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id="crayon-6074ecae9f0f3431544728" class="crayon-syntax crayon-theme-arduino-ide crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 16px !important;">
		
			<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
			<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">Arduino</span></div></div>
			<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
			<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:6; -o-tab-size:6; -webkit-tab-size:6; tab-size:6; font-size: 12px !important; line-height: 16px !important;">
/**********************************************************************
项目名称/Project          : 零基础入门学用物联网
程序名称/Program name     : stream_With_flush
团队/Team                : 太极创客团队 / Taichi-Maker (www.taichi-maker.com)
作者/Author              : CYNO朔
日期/Date（YYYYMMDD）     : 20200318
程序目的/Purpose          : 
此程序使用Serial来演示Stream类中的flush函数。
flush函数可让开发板在所有发送数据全部发送完毕之前，保持等待状态。

为了演示flush函数工作效果，一共为您准备了两个示例程序。通过这两个示例程序的
运行结果比较，您可以看到flush函数的工作效果。

此程序为没有使用flush函数的情况下，通过串口监视器显示开发板在输出一大串字符的运行效果。
-----------------------------------------------------------------------
本示例程序为太极创客团队制作的《零基础入门学用物联网》中示例程序。
该教程为对物联网开发感兴趣的朋友所设计和制作。如需了解更多该教程的信息，请参考以下网页：
http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/
***********************************************************************/

void setup() {
  Serial.begin(9600);
 
  // 记录输出串口信息前的millis时间
  unsigned long millisWithFlushStart = millis();
  
  // 通过串口输出信息
  Serial.println(F("abcdefghijklmnopqrstuvwxyz"));
  
  // 使用flush函数，让开发板在完成串口输出信息以前"原地等待"
  Serial.flush();
  
  // 记录输出串口信息后的millis时间
  unsigned long millisWithFlushStop = millis();
 
  // 通过串口监视器输出没有使用flush函数情况下，输出信息前后的时间差。
  Serial.print(F("WITH flush: "));
  Serial.print( millisWithFlushStop - millisWithFlushStart);
  Serial.println(F(" milliseconds."));
}
 
void loop() {
}

/*
Stream类用于处理字符数据流或二进制数据流。Stream类是不能被直接调用的。
然而当我们使用基于Stream类的库时，都会调用Stream中的内容。

以下Arduino库及相应库中的类都是基于Stream类所实现的。
 库          类
Core        Serial
Wifi        WiFiClient
Ehternet    EthernetClient
ESP8266FS   File
SD          File
Wire        Wire
GSM         GSMClient
SoftwareSerial  SoftwareSerial
-----------------------------------------------------------------------
*/</textarea></div>
			<div class="crayon-main" style="">
				<table class="crayon-table">
					<tr class="crayon-row">
				<td class="crayon-nums " data-settings="show">
					<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 16px !important;"><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-1">1</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-2">2</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-3">3</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-4">4</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-5">5</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-6">6</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-7">7</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-8">8</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-9">9</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-10">10</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-11">11</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-12">12</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-13">13</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-14">14</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-15">15</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-16">16</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-17">17</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-18">18</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-19">19</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-20">20</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-21">21</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-22">22</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-23">23</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-24">24</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-25">25</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-26">26</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-27">27</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-28">28</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-29">29</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-30">30</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-31">31</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-32">32</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-33">33</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-34">34</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-35">35</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-36">36</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-37">37</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-38">38</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-39">39</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-40">40</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-41">41</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-42">42</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-43">43</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-44">44</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-45">45</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-46">46</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-47">47</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-48">48</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-49">49</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-50">50</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-51">51</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-52">52</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-53">53</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-54">54</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-55">55</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-56">56</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-57">57</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-58">58</div><div class="crayon-num" data-line="crayon-6074ecae9f0f3431544728-59">59</div><div class="crayon-num crayon-striped-num" data-line="crayon-6074ecae9f0f3431544728-60">60</div></div>
				</td>
						<td class="crayon-code"><div class="crayon-pre" style="font-size: 12px !important; line-height: 16px !important; -moz-tab-size:6; -o-tab-size:6; -webkit-tab-size:6; tab-size:6;"><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-1"><span class="crayon-c">/**********************************************************************</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-2"><span class="crayon-c">项目名称/Project&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 零基础入门学用物联网</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-3"><span class="crayon-c">程序名称/Program name&nbsp;&nbsp;&nbsp;&nbsp; : stream_With_flush</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-4"><span class="crayon-c">团队/Team&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 太极创客团队 / Taichi-Maker (www.taichi-maker.com)</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-5"><span class="crayon-c">作者/Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: CYNO朔</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-6"><span class="crayon-c">日期/Date（YYYYMMDD）&nbsp;&nbsp;&nbsp;&nbsp; : 20200318</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-7"><span class="crayon-c">程序目的/Purpose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-8"><span class="crayon-c">此程序使用Serial来演示Stream类中的flush函数。</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-9"><span class="crayon-c">flush函数可让开发板在所有发送数据全部发送完毕之前，保持等待状态。</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-10">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-11"><span class="crayon-c">为了演示flush函数工作效果，一共为您准备了两个示例程序。通过这两个示例程序的</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-12"><span class="crayon-c">运行结果比较，您可以看到flush函数的工作效果。</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-13">&nbsp;</div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-14"><span class="crayon-c">此程序为没有使用flush函数的情况下，通过串口监视器显示开发板在输出一大串字符的运行效果。</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-15"><span class="crayon-c">-----------------------------------------------------------------------</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-16"><span class="crayon-c">本示例程序为太极创客团队制作的《零基础入门学用物联网》中示例程序。</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-17"><span class="crayon-c">该教程为对物联网开发感兴趣的朋友所设计和制作。如需了解更多该教程的信息，请参考以下网页：</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-18"><span class="crayon-c">http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-19"><span class="crayon-c">***********************************************************************/</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-20">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-21"><span class="crayon-t">void</span><span class="crayon-h"> </span><span class="crayon-st">setup</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-22"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-v">begin</span><span class="crayon-sy">(</span><span class="crayon-cn">9600</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-23"><span class="crayon-h"> </span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-24"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 记录输出串口信息前的millis时间</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-25"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-t">unsigned</span><span class="crayon-h"> </span><span class="crayon-r">long</span><span class="crayon-h"> </span><span class="crayon-v">millisWithFlushStart</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-st">millis</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-26"><span class="crayon-h">&nbsp;&nbsp;</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-27"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 通过串口输出信息</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-28"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">println</span><span class="crayon-sy">(</span><span class="crayon-v">F</span><span class="crayon-sy">(</span><span class="crayon-s">"abcdefghijklmnopqrstuvwxyz"</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-29"><span class="crayon-h">&nbsp;&nbsp;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-30"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 使用flush函数，让开发板在完成串口输出信息以前"原地等待"</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-31"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-v">flush</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-32"><span class="crayon-h">&nbsp;&nbsp;</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-33"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 记录输出串口信息后的millis时间</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-34"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-t">unsigned</span><span class="crayon-h"> </span><span class="crayon-r">long</span><span class="crayon-h"> </span><span class="crayon-v">millisWithFlushStop</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-st">millis</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-35"><span class="crayon-h"> </span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-36"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-c">// 通过串口监视器输出没有使用flush函数情况下，输出信息前后的时间差。</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-37"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">print</span><span class="crayon-sy">(</span><span class="crayon-v">F</span><span class="crayon-sy">(</span><span class="crayon-s">"WITH flush: "</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-38"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">print</span><span class="crayon-sy">(</span><span class="crayon-h"> </span><span class="crayon-v">millisWithFlushStop</span><span class="crayon-h"> </span><span class="crayon-o">-</span><span class="crayon-h"> </span><span class="crayon-v">millisWithFlushStart</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-39"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-st">Serial</span><span class="crayon-sy">.</span><span class="crayon-e">println</span><span class="crayon-sy">(</span><span class="crayon-v">F</span><span class="crayon-sy">(</span><span class="crayon-s">" milliseconds."</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-40"><span class="crayon-sy">}</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-41"><span class="crayon-h"> </span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-42"><span class="crayon-t">void</span><span class="crayon-h"> </span><span class="crayon-st">loop</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-43"><span class="crayon-sy">}</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-44">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-45"><span class="crayon-c">/*</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-46"><span class="crayon-c">Stream类用于处理字符数据流或二进制数据流。Stream类是不能被直接调用的。</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-47"><span class="crayon-c">然而当我们使用基于Stream类的库时，都会调用Stream中的内容。</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-48">&nbsp;</div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-49"><span class="crayon-c">以下Arduino库及相应库中的类都是基于Stream类所实现的。</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-50"><span class="crayon-c"> 库&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-51"><span class="crayon-c">Core&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Serial</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-52"><span class="crayon-c">Wifi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WiFiClient</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-53"><span class="crayon-c">Ehternet&nbsp;&nbsp;&nbsp;&nbsp;EthernetClient</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-54"><span class="crayon-c">ESP8266FS&nbsp;&nbsp; File</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-55"><span class="crayon-c">SD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-56"><span class="crayon-c">Wire&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wire</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-57"><span class="crayon-c">GSM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GSMClient</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-58"><span class="crayon-c">SoftwareSerial&nbsp;&nbsp;SoftwareSerial</span></div><div class="crayon-line" id="crayon-6074ecae9f0f3431544728-59"><span class="crayon-c">-----------------------------------------------------------------------</span></div><div class="crayon-line crayon-striped-line" id="crayon-6074ecae9f0f3431544728-60"><span class="crayon-c">*/</span></div></div></td>
					</tr>
				</table>
			</div>
		</div>
<!-- [Format Time: 0.0006 seconds] -->
<p> </p>
<p>通过以上两个程序的运行，您可以看到。在没有使用flush函数的情况下，开发板在输出信息前后时间差别微乎其微。但是在使用了flush函数以后，可以明显看到开发板输出信息占用了一定的时间。</p>
<h3>相关内容</h3>
<p><a href="../clear-incoming-buffer/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-code-reference/stream/clear-incoming-buffer/" rel="noopener noreferrer" target="_blank">清除接收缓存</a></p>
	</div><!-- .entry-content -->

	
</article><!-- #post-7839 -->

	</main><!-- .site-main -->

	<aside id="content-bottom-widgets" class="content-bottom-widgets" role="complementary">
			<div class="widget-area">
			<section id="text-2" class="widget widget_text"><h2 class="widget-title">太极创客 微信公众号</h2>			<div class="textwidget"><p><img class="alignnone" src="../../wp-content/uploads/2017/04/wechat-code128.gif" tppabs="http://www.taichi-maker.com/wp-content/uploads/2017/04/wechat-code128.gif" alt="太极创客-微信公众号" /></p>
<h3><a href="javascript:if(confirm('https://beian.miit.gov.cn/  \n\n??ļ????? Teleport Ultra ??, ?Ϊ ??һ???????????????Ϊ?????????ĵ????  \n\n????????????'))window.location='https://beian.miit.gov.cn/'" tppabs="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer"><strong>京ICP备15021217号-5</strong></a></h3>
</div>
		</section>		</div><!-- .widget-area -->
	
			<div class="widget-area">
			<section id="text-13" class="widget widget_text"><h2 class="widget-title">太极创客 官方微博</h2>			<div class="textwidget"><p><img class="size-full wp-image-1984" src="../../wp-content/uploads/2017/04/weibo-code128.gif" tppabs="http://www.taichi-maker.com/wp-content/uploads/2017/04/weibo-code128.gif" alt="太极创客 官方微博 二维码" width="128" height="128" /></p>
</div>
		</section>		</div><!-- .widget-area -->
	</aside><!-- .content-bottom-widgets -->

</div><!-- .content-area -->


	<aside id="secondary" class="sidebar widget-area" role="complementary">
		<section id="search-2" class="widget widget_search">
<form role="search" method="get" class="search-form" action="http://www.taichi-maker.com/">
	<label>
		<span class="screen-reader-text">搜索：</span>
		<input type="search" class="search-field" placeholder="搜索…" value="" name="s" />
	</label>
	<button type="submit" class="search-submit"><span class="screen-reader-text">搜索</span></button>
</form>
</section><section id="custom_html-2" class="widget_text widget widget_custom_html"><div class="textwidget custom-html-widget"><table style="border: none;" width="100%" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td style="border: none; text-align: center;" valign="top" width="100%">
<img src="../../wp-content/uploads/2019/03/QQ-group-QR-w-words.png" tppabs="http://www.taichi-maker.com/wp-content/uploads/2019/03/QQ-group-QR-w-words.png" alt="太极创客学习交流QQ群二维码" width="300" height="300" class="size-full wp-image-6726" />
</td>
</tr>
</tbody>
</table></div></section><section id="custom_html-3" class="widget_text widget widget_custom_html"><div class="textwidget custom-html-widget"><table style="border: none;" width="100%" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td style="border: none; text-align: center;" valign="top" width="100%">
<img src="../../wp-content/uploads/2019/11/QQ-group-QR-2.jpg" tppabs="http://www.taichi-maker.com/wp-content/uploads/2019/11/QQ-group-QR-2.jpg" alt="太极创客学习交流QQ群二维码" width="300" height="300" class="size-full wp-image-6726" />
</td>
</tr>
</tbody>
</table></div></section><section id="text-12" class="widget widget_text"><h2 class="widget-title">联系我们</h2>			<div class="textwidget"><p>假如您对网站内容有任何意见和建议，请发邮件到：<br />
<a href="mailto:taichimaker@163.com">taichimaker@163.com</a><br />
或者通过太极创客的社交媒体平台<a href="../../../../../contact-us/index.htm" tppabs="http://www.taichi-maker.com/contact-us/">与我们互动</a></p>
</div>
		</section><section id="text-14" class="widget widget_text"><h2 class="widget-title">版权声明</h2>			<div class="textwidget"><p><span style="color: #d3552d;"><strong>本网站访问者可将本网站提供的内容或服务用于个人学习研究以及其他非商业性或非盈利性用途。除此以外,将本网站任何内容（包括图片，文字，视频，程序代码，电路设计）或服务用于任何商业或盈利用途时,须征得本网站及相关权利人的书面许可。</strong></span></p>
</div>
		</section>	</aside><!-- .sidebar .widget-area -->

		</div><!-- .site-content -->

		<footer id="colophon" class="site-footer" role="contentinfo">
							<nav class="main-navigation" role="navigation" aria-label="页脚主菜单">
					<div class="menu-%e7%ab%99%e7%82%b9%e5%af%bc%e8%88%aa-container"><ul id="menu-%e7%ab%99%e7%82%b9%e5%af%bc%e8%88%aa-1" class="primary-menu"><li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-12974"><a href="../../../../esp8266-nodemcu-iot/iot-tuttorial/index.htm" tppabs="http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/iot-tuttorial/">物联网教程</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-9850"><a href="../../../../iot-development/index.htm" tppabs="http://www.taichi-maker.com/homepage/iot-development/">物联网开发</a>
<ul class="sub-menu">
	<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11246"><a href="../../../arduino-hardware-refrence/nodemcu/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/nodemcu/">物联网开发板</a></li>
	<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11247"><a href="../../../../iot-development/iot-dev-reference/esp8266-iot-dev-ref/index.htm" tppabs="http://www.taichi-maker.com/homepage/iot-development/iot-dev-reference/esp8266-iot-dev-ref/">物联网开发资料</a></li>
	<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11248"><a href="../../../../iot-development/iot-platform/index.htm" tppabs="http://www.taichi-maker.com/homepage/iot-development/iot-platform/">物联网平台</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-2325"><a href="../../../../arduino-tutorial-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/">Arduino 教程</a>
<ul class="sub-menu">
	<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2326"><a href="../../../../arduino-basic-tutorial-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-basic-tutorial-index/">1-基础知识篇</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2327"><a href="../../../../arduino-tutorial-index/mearm-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/mearm-index/">2-MeArm篇</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2928"><a href="../../../../arduino-tutorial-index/intelligent-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/intelligent-index/">3-智能应用篇</a></li>
	<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-5241"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/">4- 专项教程篇</a>
	<ul class="sub-menu">
		<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-7145"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm#motor" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/#motor">4-1 电机专项</a></li>
		<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-7144"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm#oop" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/#oop">4-2 面向对象基础</a></li>
		<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-7141"><a href="../../../../arduino-tutorial-index/arduino-hardware/index.htm#taile1" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-index/arduino-hardware/#taile1">4-3 太乐一号</a></li>
	</ul>
</li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-180"><a href="../../../arduino-hardware-refrence/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/">Arduino开发</a>
<ul class="sub-menu">
	<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-9847"><a href="../../../arduino-hardware-refrence/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/">Arduino开发板</a>
	<ul class="sub-menu">
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3632"><a href="../../../arduino-hardware-refrence/arduino-purchase-advice/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-purchase-advice/">Arduino 选购建议</a></li>
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3634"><a href="../../../arduino-hardware-refrence/arduino-uno/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-uno/">Arduino Uno 开发板</a></li>
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3635"><a href="../../../arduino-hardware-refrence/arduino-nano/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-nano/">Arduino Nano 开发板</a></li>
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3636"><a href="../../../arduino-hardware-refrence/arduino-mega/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-hardware-refrence/arduino-mega/">Arduino MEGA 开发板</a></li>
	</ul>
</li>
	<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11244"><a href="../../../../arduino-coding-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-coding-index/">Arduino编程</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor menu-item-has-children menu-item-179"><a href="../../../index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/">Arduino参考资料</a>
	<ul class="sub-menu">
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-3967"><a href="../../../../arduino-coding-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-coding-index/">Arduino编程参考</a>
		<ul class="sub-menu">
			<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3969"><a href="../../index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-code-reference/">Arduino 语句</a></li>
			<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11487"><a href="../../../arduino-library-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-library-index/">Arduino库</a></li>
		</ul>
</li>
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3009"><a href="../../../communication-reference-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/communication-reference-index/">Arduino通讯</a></li>
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1853"><a href="../../../circuit-reference-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/circuit-reference-index/">电路电机参考</a></li>
		<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-181"><a href="../../../arduino-sensor-index/index.htm" tppabs="http://www.taichi-maker.com/homepage/reference-index/arduino-sensor-index/">传感器应用</a></li>
	</ul>
</li>
</ul>
</li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11817"><a href="../../../../arduino-tutorial-structure/index.htm" tppabs="http://www.taichi-maker.com/homepage/arduino-tutorial-structure/">教程说明</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-4792"><a href="../../../../download/index.htm" tppabs="http://www.taichi-maker.com/homepage/download/">下载</a></li>
<li class="menu-item menu-item-type-post_type menu-item-object-post menu-item-12002"><a href="../../../../../faq/index.htm" tppabs="http://www.taichi-maker.com/faq/">常见问题</a></li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1383"><a href="../../../../../contact-us/index.htm" tppabs="http://www.taichi-maker.com/contact-us/">关于我们</a></li>
</ul></div>				</nav><!-- .main-navigation -->
			
			
			<div class="site-info">
								<span class="site-title"><a href="../../../../../index.htm" tppabs="http://www.taichi-maker.com/" rel="home">太极创客</a></span>
								<a href="javascript:if(confirm('https://cn.wordpress.org/  \n\n??ļ????? Teleport Ultra ??, ?Ϊ ??һ???????????????Ϊ?????????ĵ????  \n\n????????????'))window.location='https://cn.wordpress.org/'" tppabs="https://cn.wordpress.org/" class="imprint">
					自豪地采用WordPress				</a>
			</div><!-- .site-info -->
		</footer><!-- .site-footer -->
	</div><!-- .site-inner -->
</div><!-- .site -->

<script src="../../wp-content/themes/twentysixteen/js/skip-link-focus-fix.js-ver=20170530" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/js/skip-link-focus-fix.js?ver=20170530"></script>
<script>
var screenReaderText = {"expand":"\u5c55\u5f00\u5b50\u83dc\u5355","collapse":"\u6298\u53e0\u5b50\u83dc\u5355"};
</script>
<script src="../../wp-content/themes/twentysixteen/js/functions.js-ver=20181217" tppabs="http://www.taichi-maker.com/wp-content/themes/twentysixteen/js/functions.js?ver=20181217"></script>
<script src="../../wp-includes/js/wp-embed.min.js-ver=5.4.4" tppabs="http://www.taichi-maker.com/wp-includes/js/wp-embed.min.js?ver=5.4.4"></script>
	<script type="text/javascript">
        jQuery(document).ready(function ($) {
            //$( document ).ajaxStart(function() {
            //});

			
            for (var i = 0; i < document.forms.length; ++i) {
                var form = document.forms[i];
				if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="cdUOAfpIk_Dm" value="nzPAGvymo5Fl" />'); }
if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="XlVPCaZf_WA" value="VyntA.h3HuX" />'); }
if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="LYDGtx_A" value="qSQ9k@In" />'); }
            }

			
            $(document).on('submit', 'form', function () {
				if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="cdUOAfpIk_Dm" value="nzPAGvymo5Fl" />'); }
if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="XlVPCaZf_WA" value="VyntA.h3HuX" />'); }
if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="LYDGtx_A" value="qSQ9k@In" />'); }
                return true;
            });

			
            jQuery.ajaxSetup({
                beforeSend: function (e, data) {

                    //console.log(Object.getOwnPropertyNames(data).sort());
                    //console.log(data.type);

                    if (data.type !== 'POST') return;

                    if (typeof data.data === 'object' && data.data !== null) {
						data.data.append("cdUOAfpIk_Dm", "nzPAGvymo5Fl");
data.data.append("XlVPCaZf_WA", "VyntA.h3HuX");
data.data.append("LYDGtx_A", "qSQ9k@In");
                    }
                    else {
                        data.data =  data.data + '&cdUOAfpIk_Dm=nzPAGvymo5Fl&XlVPCaZf_WA=VyntA.h3HuX&LYDGtx_A=qSQ9k@In';
                    }
                }
            });

        });
	</script>
	</body>
</html>
